// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file distance_sensor.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace { char dummy; }
#endif

#include "distance_sensor.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>





















distance_sensor::distance_sensor()
{
    // m_timestamp_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5f3a4b84
    m_timestamp_ = 0;
    // m_min_distance_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@27f723
    m_min_distance_ = 0.0;
    // m_max_distance_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@670b40af
    m_max_distance_ = 0.0;
    // m_current_distance_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4923ab24
    m_current_distance_ = 0.0;
    // m_variance_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@7b69c6ba
    m_variance_ = 0.0;
    // m_signal_quality_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@12f41634
    m_signal_quality_ = 0;
    // m_type_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@13c27452
    m_type_ = 0;
    // m_id_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@262b2c86
    m_id_ = 0;
    // m_h_fov_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@371a67ec
    m_h_fov_ = 0.0;
    // m_v_fov_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5ed828d
    m_v_fov_ = 0.0;
    // m_q com.eprosima.idl.parser.typecode.AliasTypeCode@50d0686
    memset(&m_q, 0, (4) * 4);
    // m_orientation_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@7a3d45bd
    m_orientation_ = 0;

}

distance_sensor::~distance_sensor()
{












}

distance_sensor::distance_sensor(const distance_sensor &x)
{
    m_timestamp_ = x.m_timestamp_;
    m_min_distance_ = x.m_min_distance_;
    m_max_distance_ = x.m_max_distance_;
    m_current_distance_ = x.m_current_distance_;
    m_variance_ = x.m_variance_;
    m_signal_quality_ = x.m_signal_quality_;
    m_type_ = x.m_type_;
    m_id_ = x.m_id_;
    m_h_fov_ = x.m_h_fov_;
    m_v_fov_ = x.m_v_fov_;
    m_q = x.m_q;
    m_orientation_ = x.m_orientation_;
}

distance_sensor::distance_sensor(distance_sensor &&x)
{
    m_timestamp_ = x.m_timestamp_;
    m_min_distance_ = x.m_min_distance_;
    m_max_distance_ = x.m_max_distance_;
    m_current_distance_ = x.m_current_distance_;
    m_variance_ = x.m_variance_;
    m_signal_quality_ = x.m_signal_quality_;
    m_type_ = x.m_type_;
    m_id_ = x.m_id_;
    m_h_fov_ = x.m_h_fov_;
    m_v_fov_ = x.m_v_fov_;
    m_q = std::move(x.m_q);
    m_orientation_ = x.m_orientation_;
}

distance_sensor& distance_sensor::operator=(const distance_sensor &x)
{

    m_timestamp_ = x.m_timestamp_;
    m_min_distance_ = x.m_min_distance_;
    m_max_distance_ = x.m_max_distance_;
    m_current_distance_ = x.m_current_distance_;
    m_variance_ = x.m_variance_;
    m_signal_quality_ = x.m_signal_quality_;
    m_type_ = x.m_type_;
    m_id_ = x.m_id_;
    m_h_fov_ = x.m_h_fov_;
    m_v_fov_ = x.m_v_fov_;
    m_q = x.m_q;
    m_orientation_ = x.m_orientation_;

    return *this;
}

distance_sensor& distance_sensor::operator=(distance_sensor &&x)
{

    m_timestamp_ = x.m_timestamp_;
    m_min_distance_ = x.m_min_distance_;
    m_max_distance_ = x.m_max_distance_;
    m_current_distance_ = x.m_current_distance_;
    m_variance_ = x.m_variance_;
    m_signal_quality_ = x.m_signal_quality_;
    m_type_ = x.m_type_;
    m_id_ = x.m_id_;
    m_h_fov_ = x.m_h_fov_;
    m_v_fov_ = x.m_v_fov_;
    m_q = std::move(x.m_q);
    m_orientation_ = x.m_orientation_;

    return *this;
}

size_t distance_sensor::getMaxCdrSerializedSize(size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += ((4) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);



    return current_alignment - initial_alignment;
}

size_t distance_sensor::getCdrSerializedSize(const distance_sensor& data, size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    if ((4) > 0)
    {
        current_alignment += ((4) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
    }

    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);



    return current_alignment - initial_alignment;
}

void distance_sensor::serialize(eprosima::fastcdr::Cdr &scdr) const
{

    scdr << m_timestamp_;
    scdr << m_min_distance_;
    scdr << m_max_distance_;
    scdr << m_current_distance_;
    scdr << m_variance_;
    scdr << m_signal_quality_;
    scdr << m_type_;
    scdr << m_id_;
    scdr << m_h_fov_;
    scdr << m_v_fov_;
    scdr << m_q;

    scdr << m_orientation_;
}

void distance_sensor::deserialize(eprosima::fastcdr::Cdr &dcdr)
{

    dcdr >> m_timestamp_;
    dcdr >> m_min_distance_;
    dcdr >> m_max_distance_;
    dcdr >> m_current_distance_;
    dcdr >> m_variance_;
    dcdr >> m_signal_quality_;
    dcdr >> m_type_;
    dcdr >> m_id_;
    dcdr >> m_h_fov_;
    dcdr >> m_v_fov_;
    dcdr >> m_q;

    dcdr >> m_orientation_;
}

/*!
 * @brief This function sets a value in member timestamp_
 * @param _timestamp_ New value for member timestamp_
 */
void distance_sensor::timestamp_(uint64_t _timestamp_)
{
m_timestamp_ = _timestamp_;
}

/*!
 * @brief This function returns the value of member timestamp_
 * @return Value of member timestamp_
 */
uint64_t distance_sensor::timestamp_() const
{
    return m_timestamp_;
}

/*!
 * @brief This function returns a reference to member timestamp_
 * @return Reference to member timestamp_
 */
uint64_t& distance_sensor::timestamp_()
{
    return m_timestamp_;
}

/*!
 * @brief This function sets a value in member min_distance_
 * @param _min_distance_ New value for member min_distance_
 */
void distance_sensor::min_distance_(float _min_distance_)
{
m_min_distance_ = _min_distance_;
}

/*!
 * @brief This function returns the value of member min_distance_
 * @return Value of member min_distance_
 */
float distance_sensor::min_distance_() const
{
    return m_min_distance_;
}

/*!
 * @brief This function returns a reference to member min_distance_
 * @return Reference to member min_distance_
 */
float& distance_sensor::min_distance_()
{
    return m_min_distance_;
}

/*!
 * @brief This function sets a value in member max_distance_
 * @param _max_distance_ New value for member max_distance_
 */
void distance_sensor::max_distance_(float _max_distance_)
{
m_max_distance_ = _max_distance_;
}

/*!
 * @brief This function returns the value of member max_distance_
 * @return Value of member max_distance_
 */
float distance_sensor::max_distance_() const
{
    return m_max_distance_;
}

/*!
 * @brief This function returns a reference to member max_distance_
 * @return Reference to member max_distance_
 */
float& distance_sensor::max_distance_()
{
    return m_max_distance_;
}

/*!
 * @brief This function sets a value in member current_distance_
 * @param _current_distance_ New value for member current_distance_
 */
void distance_sensor::current_distance_(float _current_distance_)
{
m_current_distance_ = _current_distance_;
}

/*!
 * @brief This function returns the value of member current_distance_
 * @return Value of member current_distance_
 */
float distance_sensor::current_distance_() const
{
    return m_current_distance_;
}

/*!
 * @brief This function returns a reference to member current_distance_
 * @return Reference to member current_distance_
 */
float& distance_sensor::current_distance_()
{
    return m_current_distance_;
}

/*!
 * @brief This function sets a value in member variance_
 * @param _variance_ New value for member variance_
 */
void distance_sensor::variance_(float _variance_)
{
m_variance_ = _variance_;
}

/*!
 * @brief This function returns the value of member variance_
 * @return Value of member variance_
 */
float distance_sensor::variance_() const
{
    return m_variance_;
}

/*!
 * @brief This function returns a reference to member variance_
 * @return Reference to member variance_
 */
float& distance_sensor::variance_()
{
    return m_variance_;
}

/*!
 * @brief This function sets a value in member signal_quality_
 * @param _signal_quality_ New value for member signal_quality_
 */
void distance_sensor::signal_quality_(uint8_t _signal_quality_)
{
m_signal_quality_ = _signal_quality_;
}

/*!
 * @brief This function returns the value of member signal_quality_
 * @return Value of member signal_quality_
 */
uint8_t distance_sensor::signal_quality_() const
{
    return m_signal_quality_;
}

/*!
 * @brief This function returns a reference to member signal_quality_
 * @return Reference to member signal_quality_
 */
uint8_t& distance_sensor::signal_quality_()
{
    return m_signal_quality_;
}

/*!
 * @brief This function sets a value in member type_
 * @param _type_ New value for member type_
 */
void distance_sensor::type_(uint8_t _type_)
{
m_type_ = _type_;
}

/*!
 * @brief This function returns the value of member type_
 * @return Value of member type_
 */
uint8_t distance_sensor::type_() const
{
    return m_type_;
}

/*!
 * @brief This function returns a reference to member type_
 * @return Reference to member type_
 */
uint8_t& distance_sensor::type_()
{
    return m_type_;
}

/*!
 * @brief This function sets a value in member id_
 * @param _id_ New value for member id_
 */
void distance_sensor::id_(uint8_t _id_)
{
m_id_ = _id_;
}

/*!
 * @brief This function returns the value of member id_
 * @return Value of member id_
 */
uint8_t distance_sensor::id_() const
{
    return m_id_;
}

/*!
 * @brief This function returns a reference to member id_
 * @return Reference to member id_
 */
uint8_t& distance_sensor::id_()
{
    return m_id_;
}

/*!
 * @brief This function sets a value in member h_fov_
 * @param _h_fov_ New value for member h_fov_
 */
void distance_sensor::h_fov_(float _h_fov_)
{
m_h_fov_ = _h_fov_;
}

/*!
 * @brief This function returns the value of member h_fov_
 * @return Value of member h_fov_
 */
float distance_sensor::h_fov_() const
{
    return m_h_fov_;
}

/*!
 * @brief This function returns a reference to member h_fov_
 * @return Reference to member h_fov_
 */
float& distance_sensor::h_fov_()
{
    return m_h_fov_;
}

/*!
 * @brief This function sets a value in member v_fov_
 * @param _v_fov_ New value for member v_fov_
 */
void distance_sensor::v_fov_(float _v_fov_)
{
m_v_fov_ = _v_fov_;
}

/*!
 * @brief This function returns the value of member v_fov_
 * @return Value of member v_fov_
 */
float distance_sensor::v_fov_() const
{
    return m_v_fov_;
}

/*!
 * @brief This function returns a reference to member v_fov_
 * @return Reference to member v_fov_
 */
float& distance_sensor::v_fov_()
{
    return m_v_fov_;
}

/*!
 * @brief This function copies the value in member q
 * @param _q New value to be copied in member q
 */
void distance_sensor::q(const distance_sensor__float_array_4 &_q)
{
m_q = _q;
}

/*!
 * @brief This function moves the value in member q
 * @param _q New value to be moved in member q
 */
void distance_sensor::q(distance_sensor__float_array_4 &&_q)
{
m_q = std::move(_q);
}

/*!
 * @brief This function returns a constant reference to member q
 * @return Constant reference to member q
 */
const distance_sensor__float_array_4& distance_sensor::q() const
{
    return m_q;
}

/*!
 * @brief This function returns a reference to member q
 * @return Reference to member q
 */
distance_sensor__float_array_4& distance_sensor::q()
{
    return m_q;
}
/*!
 * @brief This function sets a value in member orientation_
 * @param _orientation_ New value for member orientation_
 */
void distance_sensor::orientation_(uint8_t _orientation_)
{
m_orientation_ = _orientation_;
}

/*!
 * @brief This function returns the value of member orientation_
 * @return Value of member orientation_
 */
uint8_t distance_sensor::orientation_() const
{
    return m_orientation_;
}

/*!
 * @brief This function returns a reference to member orientation_
 * @return Reference to member orientation_
 */
uint8_t& distance_sensor::orientation_()
{
    return m_orientation_;
}


size_t distance_sensor::getKeyMaxCdrSerializedSize(size_t current_alignment)
{
    size_t current_align = current_alignment;















    return current_align;
}

bool distance_sensor::isKeyDefined()
{
   return false;
}

void distance_sensor::serializeKey(eprosima::fastcdr::Cdr &scdr) const
{
    (void) scdr;
     
     
     
     
     
     
     
     
     
     
     
     
}
